package o;

import android.app.AlertDialog;
import android.content.Context;
import android.text.TextUtils;
import com.huawei.appgallery.foundation.ui.framework.widget.dialog.dialogactivity.DialogActivity.a;
import java.lang.ref.WeakReference;
import o.dky.j;

public class egx implements egz {
    private a ˊ;
    private d ˋ;
    private String ˏ = "";

    public interface d {
        void ॱˎ();
    }

    class e implements ckh.a {
        private WeakReference<Context> ˋ;
        private String ˏ;
        final /* synthetic */ egx ॱ;

        public e(egx o_egx, Context context, String str) {
            this.ॱ = o_egx;
            this.ˋ = new WeakReference(context);
            this.ˏ = str;
        }

        public void ˏ(AlertDialog alertDialog, a aVar, int i) {
            if (-1 == i) {
                Context context = (Context) this.ˋ.get();
                if (context == null) {
                    Logger.ˋ("GradeSettingGuideManager", "context == null");
                    return;
                }
                this.ॱ.ˎ(context);
                this.ॱ.ˊ();
                this.ॱ.ˊ(context, this.ˏ);
            } else if (-2 == i && this.ॱ.ˋ != null) {
                this.ॱ.ˋ.ॱˎ();
            }
        }
    }

    public egx(d dVar) {
        this.ˋ = dVar;
    }

    public void ˋ(Context context, String str) {
        if (this.ˊ != null) {
            this.ˊ.ˊ();
        }
        this.ˊ = new a(context, "GradeSettingGuideManager").ॱ(context.getString(j.ˎˏ)).ˏ(new e(this, context, str)).ˋ(-1, j.ˊ).ॱ(false);
        this.ˊ.ˎ();
    }

    private void ˊ() {
        egy.ॱ().ˎ(this.ˏ, this);
    }

    private void ˎ(Context context) {
        this.ˏ = context.hashCode() + "";
    }

    private void ˊ(Context context, String str) {
        egu.a aVar = new egu.a();
        aVar.ˋ(context.getString(j.ʼ));
        aVar.ॱ(context.getPackageName());
        egu.ˎ(context, aVar);
    }

    public void ॱ(int i) {
        Logger.ˏ("GradeSettingGuideManager", "resultCode = " + i);
        egy.ॱ().ˊ(this.ˏ);
        if (1 == i && this.ˋ != null) {
            this.ˋ.ॱˎ();
        }
    }

    public void ˋ() {
        if (this.ˊ != null) {
            this.ˊ.ˊ();
            this.ˊ = null;
        }
        if (!TextUtils.isEmpty(this.ˏ)) {
            egy.ॱ().ˊ(this.ˏ);
        }
        this.ˋ = null;
    }
}
